package com.arcvideo.acsplayer.httprequest;

import java.util.concurrent.RejectedExecutionException;

import android.annotation.SuppressLint;
import android.os.AsyncTask;
import android.os.Build;

public abstract class ParallelAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
	@SafeVarargs
	@SuppressLint("NewApi")
	public final void executeOnPoolExecutor(Params... params) throws RejectedExecutionException {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			try {
				super.executeOnExecutor(THREAD_POOL_EXECUTOR, params);
			} catch (RejectedExecutionException localRejectedExecutionException) {
				localRejectedExecutionException.printStackTrace();
			}
		} else {
			try {
				super.execute(params);
			} catch (RejectedExecutionException localRejectedExecutionException) { // 线程池溢出会抛出RejectedExecutionException错误
				localRejectedExecutionException.printStackTrace();
			}
		}
	}
}